package com.afinal.intelligencetrash.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.TextView;

import com.afinal.intelligencetrash.R;


/**
 * Created by 厂里帅小伙 on 2/25 0025.
 */

public class TipDialog extends Dialog{
    private TextView text = null;
    private CountDownTimer timer = null;
    public TipDialog(Context context) {
        super(context, R.style.DialogTheme);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tip_dialog_layout);
        text = (TextView) findViewById(R.id.text);
    }

    @Override
    public void show() {
        //1.5秒后自动消失
        if(timer == null){
            timer = new CountDownTimer(1500, 1500) {
                @Override
                public void onTick(long l) {

                }

                @Override
                public void onFinish() {
                    TipDialog.this.dismiss();
                }
            };
        }
        timer.start();
        super.show();
    }

    public TextView getText(){
        return text;
    }

}
